##ANES_2019_pilot_comparison.R

##comparison to study 3 sample of Republican respondents on feeling thermometer toward Trump

library(haven)
setwd("C:/Users/lmh735/Dropbox (Political Science)/Partisanship and leadership-Trump/2021 POBE Submission/R&R/Replication Files")
anes.2019<- read_stata("anes_pilot_2019.dta")

##key variables
##Trump Feeling Thermometer: fttrump
##Party ID - initial question: pid1d [2=Republican] OR pid1r==2 OR pidlean==1

##Republicans, including leaners
anes.2019$gop<- ifelse(anes.2019$pid1d==2 | anes.2019$pid1r==2 | anes.2019$pidlean==1, 1, 0)
summary(as.factor(anes.2019$gop)) ##1194 GOP respondents

##restrict Trump FT to responses from 0 - 100
anes.2019$fttrump_0_100<- ifelse(anes.2019$fttrump<0 | anes.2019$fttrump > 100, NA, anes.2019$fttrump)
summary(anes.2019$fttrump_0_100) ##creates 34 missing values

##summary of Trump FT among GOP respondents (including leaners)
summary(anes.2019$fttrump_0_100[anes.2019$gop==1])
sd(anes.2019$fttrump_0_100[anes.2019$gop==1], na.rm=TRUE)

